<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="paymentsPantList.title"/></title>

    <meta name="heading" content="<fmt:message key='paymentsPantList.heading'/>"/>
    <meta name="menu" content="RoleAdminPayment"/>
    <script type="text/javascript" src="<c:url value='/scripts/calendar/calendar.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/calendar/lang/calendar-es.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/calendar/calendar-setup.js'/>"></script>
    <script type="text/javascript">
        window.onload = function() {
            Calendar.setup({
                inputField: "endDate",
                ifFormat: "%d/%m/%Y",
                button: "endDate"
            });
        }
    </script>
</head>
<div id="help">
    <h2>
        <a href="<c:url value='helpPaymentsPantList.html?decorate=false'/>"
           title="<fmt:message key="help.pPL"/>"
           onclick="Modalbox.show(this.href, {title: this.title, width: 600}); return false;">
            <fmt:message key="help"/>
        </a>
    </h2>
</div>
<s:form id="cutProcessForm" action="closePeriodPaymentPant" method="post" validate="true">
    <s:hidden name="periodPaymentEmployee.id" value="%{periodPaymentEmployee.id}"/>
    <s:textfield id="endDate" key="endPeriodPaymentPant" required="true" readonly="true" size="9"/>
    <li class="buttonBar bottom">
        <s:submit cssClass="buttonPhone" method="closePeriodPaymentPant" key="button.closePeriodPaymentPant" />
    </li>
</s:form>

<fieldset>
    <legend><fmt:message key="paymentCutList.currentPeriod"/></legend>
    <table class="tableGrey" id="currentPeriod" >
        <thead>
            <tr>
                <th class="hidden"/>
                <th><fmt:message key="periodPaymentEmployee.initAmount"/></th>
                <th><fmt:message key="periodPaymentEmployee.amountWon"/></th>
                <th><fmt:message key="periodPaymentEmployee.amountPayment"/></th>
                <th><fmt:message key="periodPaymentEmployee.discount"/></th>
                <th><fmt:message key="periodPaymentEmployee.currentAmount"/></th>
                <th><fmt:message key="periodPaymentEmployee.initDate"/></th>
                <th><fmt:message key="periodPaymentEmployee.endDate"/></th>
                <th><fmt:message key="periodPaymentEmployee.closed"/></th>
                <th class="hidden"/>

            </tr>
        </thead>
        <tbody>
            <tr>
                <td><s:property id="periodPaymentEmployee.initAmount" value="periodPaymentEmployee.initAmount"/></td>
                <td><s:property id="periodPaymentEmployee.amountWon" value="periodPaymentEmployee.amountWon"/></td>
                <td><s:property id="periodPaymentEmployee.amountPayment" value="periodPaymentEmployee.amountPayment"/></td>
                <td><s:property id="periodPaymentEmployee.discount" value="periodPaymentEmployee.discount"/></td>
                <td><s:property id="periodPaymentEmployee.currentAmount" value="periodPaymentEmployee.currentAmount"/></td>
                <td><s:property id="periodPaymentEmployee.initDate" value="periodPaymentEmployee.initDate"/></td>
                <td><s:property id="periodPaymentEmployee.endDate" value="periodPaymentEmployee.endDate"/></td>
                <td><s:if test="%{periodPaymentEmployee.closed}" >
                        <fmt:message key="asistanceControl.true"/>
                    </s:if>
                    <s:else>
                        <fmt:message key="asistanceControl.false"/>
                </s:else></td>
            </tr>
        </tbody>
    </table>
</fieldset>

<c:set var="buttons">
    <c:if test="${canAdd}">
        <input type="button" style="margin-right: 5px"
               onclick="location.href='<c:url value="/editPaymentsPant.html"/>'"
               value="<fmt:message key="button.add"/>"/>
    </c:if>
    <input type="button" onclick="location.href='<c:url value="/backToEmployeesPant.html"/>'"
           value="<fmt:message key="button.done"/>"/>
</c:set>

<c:out value="${buttons}" escapeXml="false" />

<s:set name="balances" value="balances" scope="request"/>
<display:table name="balances" class="table" requestURI="" id="balanceList" export="true" pagesize="25">
    <display:column titleKey="print">
        <c:if test="${balanceList.typeBalance == 3}">
            <a href="<c:url value="/printPaymentsPant.html?id=${balanceList.paymentsPant.id}"/>">
                <img src="<c:url value="/images/iconInformation.gif" />" alt="Print" /></a>
        </c:if>
    </display:column>
    <display:column property="dateBalance" titleKey="balance.dateBalance"/>
    <display:column property="amountWon" titleKey="balance.amountWon"/>
    <display:column property="amountPaid" titleKey="balance.amountPaid"/>
    <display:column property="balance" titleKey="balance.balance"/>
    <display:column property="observation" titleKey="balance.observation"/>
    <display:column property="paymentsPant.code" titleKey="paymentsPant.code"/>
    <display:column titleKey="delete">
        <c:if test="${balanceList.typeBalance == 3 && balanceList.id == lastBalanceId}">
            <a href="<c:url value="/deletePaymentsPant.html?id=${balanceList.paymentsPant.id}"/>">
                <img src="<c:url value="/images/trash.png" />" alt="Edit" />
            </a>
        </c:if>
    </display:column>

    <display:setProperty name="paging.banner.item_name" value="balances"/>
    <display:setProperty name="paging.banner.items_name" value="balances"/>

    <display:setProperty name="export.excel.filename" value="BalanceList.xls"/>
    <display:setProperty name="export.csv.filename" value="BalanceList.csv"/>
    <display:setProperty name="export.pdf.filename" value="BalanceList.pdf"/>
</display:table>

<c:out value="${buttons}" escapeXml="false" />

<script type="text/javascript">
    highlightTableRows("paymentsPantList");
</script>